<?php 
define("TOKEN","callback");
$APPID='wx873faf7512b61145';  
$REDIRECT_URI='http://formtest1.sinaapp.com/action.php';
$scope='snsapi_base';
//$scope='snsapi_userinfo';//需要授权

$url='https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$APPID.'&redirect_uri='.urlencode($REDIRECT_URI).'&response_type=code&scope='.$scope.'&state='.$state.'#wechat_redirect';
header("Location:".$url);
?>